﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ExportToPLMX.SimulationStateExporter.CApExportToPlmxObjectStateData
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using EngineeringInternalExtension;
using System.Runtime.Serialization;


namespace DnProcessSimulateCommands.ExportToPLMX.SimulationStateExporter;

[DataContract]
internal class CApExportToPlmxObjectStateData
{
  [DataMember(Order = 0)]
  public int i;
  [DataMember(EmitDefaultValue = false, Order = 1)]
  public double? tx;
  [DataMember(EmitDefaultValue = false, Order = 2)]
  public double? ty;
  [DataMember(EmitDefaultValue = false, Order = 3)]
  public double? tz;
  [DataMember(EmitDefaultValue = false, Order = 4)]
  public double? rx;
  [DataMember(EmitDefaultValue = false, Order = 5)]
  public double? ry;
  [DataMember(EmitDefaultValue = false, Order = 6)]
  public double? rz;
  [DataMember(EmitDefaultValue = false, Order = 7)]
  public int? v;
  [DataMember(EmitDefaultValue = false, Order = 8)]
  public double? cp;
  [DataMember(EmitDefaultValue = false, Order = 9)]
  public double? ca;

  public override bool Equals(object other)
  {
    CApExportToPlmxObjectStateData plmxObjectStateData = other as CApExportToPlmxObjectStateData;
    int num;
    if (this.Equals(this.tx, plmxObjectStateData.tx) && this.Equals(this.ty, plmxObjectStateData.ty) && this.Equals(this.tz, plmxObjectStateData.tz) && this.Equals(this.rx, plmxObjectStateData.rx) && this.Equals(this.ry, plmxObjectStateData.ry) && this.Equals(this.rz, plmxObjectStateData.rz))
    {
      int? v = this.v;
      double? val = v.HasValue ? new double?((double) v.GetValueOrDefault()) : new double?();
      v = plmxObjectStateData.v;
      double? otherVal = v.HasValue ? new double?((double) v.GetValueOrDefault()) : new double?();
      num = this.Equals(val, otherVal) ? 1 : 0;
    }
    else
      num = 0;
    return num != 0 && this.Equals(this.cp, plmxObjectStateData.cp) && this.Equals(this.ca, plmxObjectStateData.ca);
  }

  private bool Equals(double? val, double? otherVal)
  {
    return !val.HasValue ? val.Equals((object) otherVal) : TxDoubleExtension.AlmostEquals(val.Value, otherVal.Value);
  }
}
